package com.team.mp.api.controller;

import com.team.mp.api.service.intf.ServiceItemsService;
import com.team.mp.mapper.entity.ServiceItems;
import com.team.mp.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author fan_lee
 * @date 2023/3/28 21:24
 */
@RestController
@RequestMapping("/api/item/")
@Api(tags = "服务项目相关接口")
public class ServiceItemController {
    @Resource
    private ServiceItemsService itemsService;

    @GetMapping("list")
    @ApiOperation(value = "获取服务包列表")
    public R servicePacks(Integer page, Integer size, Integer itemType, String iname){
        return itemsService.queryPage(page, size, itemType, iname);
    }

    @PostMapping("audit")
    @ApiOperation(value = "修改服务包状态")
    public R update(@RequestBody ServiceItems items){
        return itemsService.updateById(items);
    }


    @PostMapping("addItem")
    @ApiOperation(value = "服务项目新增")
    public R addItems(@RequestBody ServiceItems items){
        return itemsService.add(items);
    }

    @GetMapping("delete")
    @ApiOperation(value = "服务项目删除")
    public R delete(Integer id){
        return itemsService.deleteById(id);
    }

}
